package homework;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;

public class Work5 {
	public static void main(String[] args) throws IOException {
		BufferedReader fos=new BufferedReader(new FileReader("read.txt"));
		ArrayList<String> list = new ArrayList<>();
		String line;
		while((line=fos.readLine())!=null){
			list.add(line);
		}
		String[] lines=list.get(0).split("-");
		Arrays.sort(lines);
		StringBuilder str = new StringBuilder();
		for(int i=0;i<lines.length;i++){
			str.append(lines[i]);
			if(i!=lines.length-1){
				str.append('-');
			}
		}
		FileWriter fis=new FileWriter("read.txt");
		fis.write(str.toString());
		fis.close();
	}
}
